package hlhj.fhp.burst.activitys

import android.graphics.Color
import android.os.Bundle
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.shuyu.gsyvideoplayer.GSYVideoManager
import com.tenma.ventures.base.TMActivity
import com.tenma.ventures.bean.utils.TMSharedPUtil
import hlhj.fhp.burst.R
import kotlinx.android.synthetic.main.activity_burst_video_play_aty.*

class VideoPlayAty : TMActivity() {

    private var videoUrl=""
    private var thumbUrl=""
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_burst_video_play_aty)
        if (null!= TMSharedPUtil.getTMThemeColor(this)&&TMSharedPUtil.getTMThemeColor(this).length>0){
            loTittle.setBackgroundColor(Color.parseColor(TMSharedPUtil.getTMThemeColor(this)))
        }
        videoUrl=intent.getStringExtra("url")
//        videoUrl="http://cdn.376600500.com/20180709174457/lqHBPEluwqU1ZZ9mSPxSWm2yx_p6"
        thumbUrl=intent.getStringExtra("img")
        videoPlayer.setUp(videoUrl
                ,true, "")
        val imageView = ImageView(this)
        videoPlayer.thumbImageView=imageView
        Glide.with(this).load(thumbUrl).into(imageView)
        videoPlayer.fullscreenButton.setOnClickListener {
            videoPlayer.startWindowFullscreen(this@VideoPlayAty,false,true);
        }
        videoPlayer.backButton.setOnClickListener {
            finish()
        }
        btExit.setOnClickListener {
            finish()
        }
    }
    override fun onPause() {
        GSYVideoManager.onPause()
        super.onPause()
    }
    override fun onDestroy() {
        GSYVideoManager.releaseAllVideos()
        super.onDestroy()
    }


}
